<!--nuc未拉取人员-->
<template>
  <div class="log">
    <basic-container>
      <avue-crud
          ref="crud"
          :data="tableData"
          :option="tableOption"
          :page.sync="page"
          :table-loading="tableLoading"
          @search-reset="searchReset"
          @on-load="getList"
          @search-change="searchChange"
          @size-change="sizeChange"
          @current-change="currentChange">
        <template slot="parentName" slot-scope="scope">
          <p v-if="scope.row.parentName == ''">无</p>
          <p v-if="scope.row.parentName == null">无</p>
          <p v-else>{{scope.row.parentName}}</p>
        </template>
        <template slot="deptName" slot-scope="scope">
          <p v-if="scope.row.deptName == ''">无</p>
          <p v-if="scope.row.deptName == null">无</p>
          <p v-else>{{scope.row.deptName}}</p>
        </template>
        <template slot="identityName" slot-scope="scope">
          <p v-if="scope.row.identityName == ''">无</p>
          <p v-if="scope.row.identityName == null">无</p>
          <p v-else>{{scope.row.identityName}}</p>
        </template>
        <template slot="buildingName" slot-scope="scope">
          <p v-if="scope.row.buildingName == ''">无</p>
          <p v-if="scope.row.buildingName == null">无</p>
          <p v-else>{{scope.row.buildingName}}</p>
        </template>
        <template slot="dormNumber" slot-scope="scope">
          <p v-if="scope.row.dormNumber == ''">无</p>
          <p v-if="scope.row.dormNumber == null">无</p>
          <p v-else>{{scope.row.dormNumber}}</p>
        </template>
        <template slot="nucCode" slot-scope="scope">
          <p v-if="scope.row.nucCode == ''">无</p>
          <p v-if="scope.row.nucCode == null">无</p>
          <p v-else>{{scope.row.nucCode}}</p>
        </template>
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
import {notPulledObj} from '@/api/nuc/index'
import {mapGetters} from 'vuex'
import {PASS_DETAILS} from "@/const/Dict";


export default {
  name: "notPulled",
  data() {
    return {
      tableData: [],
      searchForm: {},
      page: {
        total: 0, // 总页数
        currentPage: 1, // 当前页数
        pageSize: 10 // 每页显示多少条
      },
      tableLoading: false,
       tableOption : {
        border: true,  //竖线边框
        index: true,  //表格序号
        indexLabel: '序号',  //序号的标题
        stripe: true,  //是否显示表格的斑马条纹
        align: 'center',  //表格列对其方式
        emptyBtnText:'重置', //清空按钮文案
        searchMenuSpan: 6,  //搜索框长度
        menu:false,   //是否显示操作栏
        props: {
          label: 'label',
          value: 'value'
        },
        column: [
          {
            label: '姓名',
            prop: 'personName',
            search: true,
          }, {
            label: '校区',
            prop: 'campusDeptArea',
            dicData: PASS_DETAILS,
            editDisplay: false,
          },{
            label: '年级',
            prop: 'parentName',
            slot:true,
          },{
            label: '班级',
            prop: 'deptName',
            slot:true,
          },{
            label: '身份',
            prop: 'identityName',
            slot:true,
          },{
            label: '楼栋',
            prop: 'buildingName',
            slot:true,
          },{
            label: '宿舍',
            slot:true,
            prop: 'dormNumber',
          },{
            label: '未拉取nuc',
            width:700,
            prop: 'nucCode',
            slot:true,
          },
        ]
      }
    }
  },
  computed: {
    ...mapGetters(['permissions']),
  },
  methods: {
    //展示表格
    getList(page, params) {
      this.tableLoading = true
      notPulledObj(Object.assign({
        current: page.currentPage,
        size: page.pageSize,
      }, params, this.searchForm)).then(response => {
        this.tableData = response.data.data.records
        this.page.total = response.data.data.total
        this.tableLoading = false
      })
    },


    //搜索页面内容
    searchChange(form, done) {
      this.searchForm = form
      this.page.currentPage = 1
      this.getList(this.page, form)
      done()
    },

    //点击每页多少条会调size-change方法回调
    sizeChange(size) {
      this.page.pageSize = size
    },

    //点击页码会调用current-change方法回调当前页
    currentChange(current) {
      this.page.currentPage = current
    },

    //清空时重置页面
    searchReset(){
      this.page={};
      this.searchForm = 0;
      this.getList(this.page)
    }
  }
}
</script>
<style scoped>
/deep/.avue-crud__menu{
  display: none;
}
/deep/.el-form-item__label{
  text-align: left;
}
/deep/.avue-form__row{
  padding-left: 2px !important;
  padding-right: 36px!important;
}
/deep/.avue-form__menu--center{
  text-align: left;
}
/deep/.avue-form__menu--center .el-button{
  margin: 0 20px 0 0;
}
</style>